home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / exec / adddevice.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  79 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: adddevice.c,v 1.4 1996/08/13 13:55:55 digulla Exp $
  4.     $Log: adddevice.c,v $
  5.     Revision 1.4  1996/08/13 13:55:55  digulla
  6.     Replaced __AROS_LA by __AROS_LHA
  7.     Replaced some __AROS_LH*I by __AROS_LH*
  8.     Sorted and added includes
  9.  
  10.     Revision 1.3  1996/08/01 17:41:01  digulla
  11.     Added standard header for all files
  12.  
  13.     Desc:
  14.     Lang: english
  15. */
  16. #include <exec/execbase.h>
  17. #include <exec/devices.h>
  18. #include <aros/libcall.h>
  19.  
  20. /*****************************************************************************
  21.  
  22.     NAME */
  23.     #include <clib/exec_protos.h>
  24.  
  25.     __AROS_LH1(void, AddDevice,
  26.  
  27. /*  SYNOPSIS */
  28.     __AROS_LHA(struct Device *, device,A1),
  29.  
  30. /*  LOCATION */
  31.     struct ExecBase *, SysBase, 72, Exec)
  32.  
  33. /*  FUNCTION
  34.     Adds a given device to the system's device list after checksumming
  35.     the device vectors. This function is not for general use but
  36.     (of course) for building devices that don't use exec's MakeLibrary()
  37.     mechanism.
  38.  
  39.     INPUTS
  40.     device - Pointer to a ready for use device structure.
  41.  
  42.     RESULT
  43.  
  44.     NOTES
  45.  
  46.     EXAMPLE
  47.  
  48.     BUGS
  49.  
  50.     SEE ALSO
  51.     RemDevice(), OpenDevice(), CloseDevice()
  52.  
  53.     INTERNALS
  54.  
  55.     HISTORY
  56.  
  57. ******************************************************************************/
  58. {
  59.     __AROS_FUNC_INIT
  60.  
  61.     /* Just in case the user forgot them */
  62.     device->dd_Library.lib_Node.ln_Type=NT_DEVICE;
  63.     device->dd_Library.lib_Flags|=LIBF_CHANGED;
  64.  
  65.     /* Build checksum for device vectors */
  66.     SumLibrary(&device->dd_Library);
  67.  
  68.     /* Arbitrate for the device list */
  69.     Forbid();
  70.  
  71.     /* And add the device */
  72.     Enqueue(&SysBase->DeviceList,&device->dd_Library.lib_Node);
  73.  
  74.     /* All done. */
  75.     Permit();
  76.     __AROS_FUNC_EXIT
  77. } /* AddDevice */
  78.  
  79.